# Contributor: Will Sinatra <wpsinatra@gmail.com>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=lua-lunit
_pkgname=lunit
pkgver=0.5
pkgrel=1
pkgdesc="a unit testing framework for lua, written in lua"
url="https://mroth.net/lunit"
license="MIT"
arch="noarch"
source="https://mroth.net/lunit/lunit-$pkgver.tar.gz"
options="!check"
builddir="$srcdir/$_pkgname-$pkgver"

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
done

package() {
	mkdir -p "$pkgdir"
}

_subpackage() {
	local _lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $_lver)"
	depends="lua$_lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$_lver"
	local destdir="$subpkgdir/usr/share/lua/$_lver"

	cd "$builddir"
	mkdir -p "$destdir"
	cp lunit.lua "$destdir"/
}
sha512sums="
3e91703047505de5ff49f40529e8bb7a54aa7d4fcf0b69476096a42c7895fdc91154230c8287973376635d352f1cd76a45ba97588e88a6c9474371a1d69625d1  lunit-0.5.tar.gz
"
